<?php
/**
 * @Author: kendy
 * @Date:   2019-10-28 17:03:13
 * @Last Modified by:   jiayanting
 * @Last Modified time: 2020-01-21 16:33:23
 */
namespace app\api\model; 
use think\Model;
use think\Db; 
class TourTicket extends Model
{ 
     public function getTourTicketList($where,$page,$limit,$field='')
     {
         $limit = ($limit==='')?config('page_size'):$limit; 
         $field = ($field==='')?'*':$field; 
         $where['is_del'] = 0;
         $where['is_use'] = 1;
         $resultData = Db::name('tour_ticket')
         ->field($field)
         ->where($where)
         ->select(); 
     }

     public function getMinTicketPrice($tour_id,$field){
          $res= Db::name('tour_ticket')
                ->where('tour_id',$tour_id)
                ->where('is_use',1)
                ->where('is_del',0)
                ->min($field);
            if($res) return $res;
            return 0;

     }
         public function getTicketInfo($tour_id){
          $res= Db::name('tour_ticket')
                ->where('tour_id',$tour_id)
                ->where('is_use',1)
                ->where('is_del',0)
                ->find();
            if($res) return $res;
            return [];

     }

}